<?php
    define('WAP_SITE_URL', '/wap');
    require('core.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="baidu-tc-verification" content="06ec64c6a12b25295c7aba93ed9d3038"/>
    <meta charset="UTF-8">
    <?php
        $config = Model('setting')->getListSetting();
    ?>
    <title><?php echo $config['site_name'] ?></title>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="full-screen" content="yes"/>
    <meta name="browsermode" content="application"/>
    <!-- QQ强制竖屏 QQ强制全屏 -->
    <meta name="x5-orientation" content="portrait"/>
    <meta name="x5-fullscreen" content="true"/>
    <meta name="x5-page-mode" content="app"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="css/reset.css">
    <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/swiper-3.4.2.min.css">
    <link rel="stylesheet" type="text/css" href="css/main.css">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script src="js/swiper-3.4.2.min.js"></script>
    <script src="/wap/js/wechat_login.js"></script>
</head>
<body>
<?php
    $first_pic = @include(BASE_DATA_PATH . '/mobile/config.php');
    if (!empty($first_pic['pic']) && $first_pic['open_first_pic'] == 1) {
        ?>
        <script>
            if (window.sessionStorage.show_pic == 1) {
                document.write("<style>#first_pic{display: none !important;} body{overflow: auto !important;}</style>")
            }
        </script>
        <style>
            body {
                overflow: hidden;
            }

            #first_pic {
                width: 100% !important;
                height: 100% !important;
                background-size: cover;
                z-index: 100000000000000000000000;
            }
        </style>
        <div id="first_pic" style="position: fixed;background-image: url(<?php echo $first_pic['pic'] ?>);z-index: 10000;overflow: hidden;background-repeat: no-repeat;background-size: 100% 100%;">

        </div>
        <script>
            $('#first_pic').css({
                height: $(window).height()
            }).click(function () {
                $(this).fadeOut();
                $('body').css({
                    overflow: 'auto'
                })
                window.sessionStorage['show_pic'] = 1;
            });

            setTimeout(function () {
                $('#first_pic').trigger('click');
            }, 3000)

        </script>
        <?php
    }
?>



<header class="main" id="header" style="height:2.75rem;">
	<div class="header-wrap">

		<a class="header-l" href="/" style="width:30%;display:block;float:left;height:2.75rem;">
			<img src="/data/upload/shop/common/<?php echo $config['site_logo']?>" style="height:2.75rem;margin:0 auto;display:block;"/>
		</a>

		<div class="header-inp" style="width:55%;float:left;height:2.75rem;line-height:2.75rem;">
			<input type="text" class="search-input" value="" id="keyword" placeholder="请输入商品名" maxlength="50" autocomplete="on" autofocus style="width:80%;border:1px solid #ccc;padding:0.2rem;margin-left:1rem;border-radius:1.25rem;text-indent:1rem;outline: aliceblue;">
		</div>

		<div class="header-r" style="width:15%;float:left;text-align:center;height:2.75rem;line-height:2.75rem;">
			<a id="header-nav" class="search-btn" href="javascript:void(0);" style="background:none;color:#777;height:2.75rem;text-align:center;">搜索</a>
		</div>


	</div>
</header>

<header class="main" style="display:none">
    <div class="header-wrap">
        <div class="header-wrap">
            <a href="tmpl/search.php" class="header-inp"> <i class="icon"></i> <span class="search-input" id="keyword">请输入关键词</span>
            </a>
        </div>
    </div>
</header>
<?php
    if ($first_pic['open_icons'] == 1) {

        ?>
        <div class="nctouch-home-nav fixed-Width" style="padding-top: 0;">
            <ul style="padding: 0;">
                <?php
                    if (!isset($first_pic)) {
                        $first_pic = array();
                    }
                    for ($i = 0; $i < 5; $i++) {

                        ?>
                        <li><a href="<?php echo $first_pic['link'][$i] ?>"><span style="background: none;">
					  <img src="<?php echo $first_pic['pics'][$i] ?>"
                               style="width: 60px;height: 60px;border:0;border-radius:60px" alt="">
                    </span>

                        <p><?php echo $first_pic['text'][$i] ?></p>
                        </a></li>
                    <?php
                    }
                ?>

            </ul>
        </div>
        <?php
    }
?>
<div id="header_faker"></div>
<div class="main" id="main-container"></div>
<footer id="footer"></footer>
<script type="text/html" id="adv_list">
    <div class="adv_list">
        <div class="swiper-wrapper">
            <% for (var i in item) { %>
            <div class="swiper-slide" data-swiper-autoplay="3000">
                <a href="<%= item[i].url %>">
                    <img src="<%= item[i].image %>" alt="">
                </a>
            </div>
            <% } %>
        </div>
        <div class="swiper-pagination">

        </div>
    </div>
</script>
<script type="text/html" id="home1">
    <div class="index_block home1">
        <% if (title) { %>
        <div class="title"><%= title %></div>
        <% } %>
        <div class="content">
            <div class="item">
                <a href="<%= url %>">
                    <img src="<%= image %>" alt="">
                </a>
            </div>
        </div>
    </div>
</script>
<script type="text/html" id="home2">
    <div class="index_block home2">
        <% if (title) { %>
        <div class="title"><%= title %></div>
        <% } %>
        <div class="content">
            <div class="item home2_1">
                <a href="<%= square_url %>"><img src="<%= square_image %>" alt=""></a>
            </div>
            <div class="item home2_2">
                <div >
                    <div >
                        <a href="<%= rectangle1_url %>"><img src="<%= rectangle1_image %>" alt=""></a>
                    </div>
                    <div>
                        <a href="<%= rectangle2_url %>"><img src="<%= rectangle2_image %>" alt=""></a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>
<script type="text/html" id="home3">
    <div class="index_block home3">
        <% if (title) { %>
        <div class="title"><%= title %></div>
        <% } %>
        <div class="content">
            <% for (var i in item) { %>
            <div class="item">
                <a href="<%= item[i].url %>"><img src="<%= item[i].image %>" alt=""></a>
            </div>
            <% } %>
        </div>
    </div>
</script>
<script type="text/html" id="home4">
    <div class="index_block home2">
        <% if (title) { %>
        <div class="title"><%= title %></div>
        <% } %>
        <div class="content">
            <div class="item home2_2">
                <div >
                    <div >
                        <a href="<%= rectangle1_url %>"><img src="<%= rectangle1_image %>" alt=""></a>
                    </div>
                    <div>
                        <a href="<%= rectangle2_url %>"><img src="<%= rectangle2_image %>" alt=""></a>
                    </div>
                </div>
            </div>
            <div class="item home2_1">
                <a href="<%= square_url %>"><img src="<%= square_image %>" alt=""></a>
            </div>
        </div>
    </div>
</script>
<script type="text/html" id="home5">
    <div class="index_block home5">
        <% if (title) { %>
        <div class="title"><%= title %></div>
        <% } %>
        <div class="content">
            <div class="item">
                <div class="home5_item home5_1"><a href="<%= rectangle1_url %>"><img src="<%= rectangle1_image %>" alt=""></a></div>
                <div class="home5_item home5_2"><a href="<%= rectangle2_url %>"><img src="<%= rectangle2_image %>" alt=""></a></div>
                <div class="home5_item home5_3"><a href="<%= rectangle3_url %>"><img src="<%= rectangle3_image %>" alt=""></a></div>
            </div>
        </div>
    </div>
</script>

<script type="text/html" id="goods">
    <div class="index_block goods">
        <% if (title) { %>
        <div class="title"><%= title %></div>
        <% } %>
        <div class="content">
            <% for (var i in item) { %>
            <div class="goods-item">
                <a href="tmpl/product_detail.html?goods_id=<%= item[i].goods_id %>">
                    <div class="goods-item-pic"><img src="<%= item[i].goods_image %>" alt=""></div>
                    <div class="goods-item-name"><%= item[i].goods_name %></div>
                    <div class="goods-item-price">
                        ￥<%= item[i].goods_promotion_price %>
                        <div class='ext'>
                            <% if (item[i].open_tax == 1) { %>
                            <span class='ext'>保税</span>
                            <% } %>
                            <% if (item[i].is_own == 1) { %>
                            <span class='ext'>自营</span>
                            <% } %>
                        </div>

                    </div>
                </a>
            </div>
            <% } %>
        </div>
    </div>
</script>

<script type="text/html" id="goods1">
    <div class="index_block goods">
        <% if (title) { %>
        <div class="title"><%= title %></div>
        <% } %>
        <div class="content">
            <% for (var i in item) { %>
            <div class="goods1-item">
                <a href="tmpl/product_detail.html?goods_id=<%= item[i].goods_id %>">
                    <div class="goods1-item-pic"><img src="<%= item[i].goods_image %>" alt=""></div>
                    <div class="goods1-item-name"><%= item[i].goods_name %></div>
                    <div class="goods1-item-price">￥<%= item[i].goods_promotion_price %></div>
                    <div class="goods1-sales">销量：<%= item[i].goods_salenum %></div>
                    <div class='ext'>
                        <% if (item[i].open_tax == 1) { %>
                        <span class='ext'>保税</span>
                        <% } %>
                        <% if (item[i].is_own == 1) { %>
                        <span class='ext'>自营</span>
                        <% } %>
                    </div>
                </a>
            </div>
            <% } %>
        </div>
    </div>
</script>


<script type="text/html" id="goods2">
    <div class="index_block goods">
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <% for (var i in item) { %>
                <div class="swiper-slide goods2-item">
                    <a href="tmpl/product_detail.html?goods_id=<%= item[i].goods_id %>">
                        <div class="goods2-item-pic"><img src="<%= item[i].goods_image %>" alt=""></div>
                        <div class="goods-item-name"><%= item[i].goods_name %></div>
                        <div class="goods-item-price">
                            ￥<%= item[i].goods_promotion_price %>
                        </div>
                    </a>
                </div>
                <% } %>
            </div>
        </div>
    </div>
</script>

<script type="text/html" id="m3xn">
    <div class="index_block m3xn">
        <% if (title) { %>
        <div class="title"><%= title %></div>
        <% } %>
        <div class="content">
            <% for (var i in item) { %>
            <div class="m3-goods-item">
                <a href="tmpl/product_detail.html?goods_id=<%= item[i].goods_id %>">
                    <div class="m3-goods-item-pic"><img src="<%= item[i].goods_image %>" alt="">
                    </div>
                </a>
                <div class="goods-item-name"><%= item[i].goods_name %></div>
                <div class="goods-item-price">
                    <div>
                        ￥<%= item[i].goods_promotion_price %>
                    </div>
                    <div class='ext'>
                        <% if (item[i].open_tax == 1) { %>
                        <span class='ext'>保税</span>
                        <% } %>
                        <% if (item[i].is_own == 1) { %>
                        <span class='ext'>自营</span>
                        <% } %>
                    </div>

                </div>
            </div>
            <% } %>
        </div>
    </div>
</script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/zepto.min.js"></script>
<script type="text/javascript" src="js/template.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/swipe.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/tmpl/footer.js"></script>
<script>
    var timer = setInterval(function () {
        if ($('.goods-item-pic img').length) {
            $('.goods-item-pic img').each(function () {
                $(this).height($(this).width());
            });
            $('body').css('overflow-x', 'hidden');
            clearInterval(timer);
        }
        if ($('.m3-goods-item-pic img').length) {
            $('.m3-goods-item-pic img').each(function () {
                $(this).height($(this).width());
            });
            $('body').css('overflow-x', 'hidden');
            clearInterval(timer);
        }
        if ($('.goods2-item-pic img').length) {
            $('.goods2-item-pic img').each(function () {
                $(this).height($(this).width());
            });
            $('body').css('overflow-x', 'hidden');
            clearInterval(timer);
        }
        if ($('.goods1-item-pic img').length) {
            $('.goods1-item-pic img').each(function () {
                $(this).height($(this).width());
            });
            $('body').css('overflow-x', 'hidden');
            clearInterval(timer);
        }
    }, 10);
</script>
<script>
    if (window.DeviceMotionEvent) {
        window.addEventListener('devicemotion',deviceMotionHandler, false);
    }

    var SHAKE_THRESHOLD = 800;
    var last_update = 0;
    var x, y, z, last_x, last_y, last_z;

    function deviceMotionHandler(eventData) {

        var acceleration =eventData.accelerationIncludingGravity;
        //alert(newDate().getTime());
        var curTime = new Date().getTime();

        // alert(curTime - last_update);
        if ((curTime - last_update)> 300) {

            var diffTime = curTime -last_update;
            last_update = curTime;

            x = acceleration.x;
            y = acceleration.y;
            z = acceleration.z;

            var speed = Math.abs(x +y + z - last_x - last_y - last_z) / diffTime * 10000;


            last_x = x;
            last_y = y;
            last_z = z;
        }
    }
</script>
</body>
</html>



